T
the Type of object being verified
IdeaBlade DevForce 2010 Help Reference
DelegateVerifier<T> Class
Members  Example  See Also  Send Feedback
IdeaBlade.Validation Assembly > IdeaBlade.Validation Namespace : DelegateVerifier<T> Class



A programmatically-created verifier with custom verification and applicability logic.

Object Model

DelegateVerifier<T> ClassVerifierErrorMessageInfo ClassVerifierArgs ClassVerifierEngine ClassVerifierOptions Class

Syntax

Visual Basic (Declaration) 
Public Class DelegateVerifier(Of T As Class) 
   Inherits Verifier(Of T)
   Implements System.IComparable(Of Verifier) 
Visual Basic (Usage)Copy Code
Dim instance As DelegateVerifier(Of T)
C# 
public class DelegateVerifier<T> : Verifier<T>, System.IComparable<Verifier>  
where T: class
C++/CLI 
generic<typename T>
public ref class DelegateVerifier : public Verifier<T>, System.IComparable<Verifier>  
where T: ref class

Type Parameters

T
the Type of object being verified

Example

C#Copy Code
private DelegateVerifier SampleDelegateVerifier() {
  // A simple example adding a delegate verifier to ensure that Employee
  // BirthDate falls before HireDate.

  // Apply verifier only when have data for both properties.
  ApplicabilityConstraint<Employee> constraint = (emp, trigger, context) => {
    return emp.HireDate.HasValue && emp.BirthDate.HasValue ?
      VerifierApplicability.Yes : VerifierApplicability.InsufficientData;
  };

  // Define the verification performed - BirthDate must precede HireDate
  VerifierCondition<Employee> condition = (emp, trigger, context) => {
    return new VerifierResult(emp.BirthDate < emp.HireDate);
  };

  var errorMessage = "Must be born before hired";

  // Create the verifier.  Execute only after set and on instance.
  var v = new DelegateVerifier<Employee>(errorMessage, constraint, condition);
  v.VerifierOptions.ExecutionModes = VerifierExecutionModes.InstanceAndOnAfterSetTriggers;

  // Add triggers - setters for HireDate and BirthDate properties will trigger.
  v.AddTriggers(Employee.PropertyMetadata.HireDate.Name, Employee.PropertyMetadata.BirthDate.Name);

  return v;
}

Remarks

A DelegateVerifier allows you to programmatically build a verifier. These verifiers will be discovered if returned from an IVerifierProvider implementation. You can also add the verifier directly to the engine using VerifierEngine.AddVerifier.

Inheritance Hierarchy

System.Object
   IdeaBlade.Validation.Verifier
      IdeaBlade.Validation.Verifier<T>
         IdeaBlade.Validation.DelegateVerifier<T>

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.